//
//  GDLoopCell.m
//  Gunterapple
//
//  Created by 热带雨林 on 2020/4/4.
//  Copyright © 2020 热带雨林. All rights reserved.
//

#import "GDLoopCell.h"
@interface GDLoopCell ()
@property (nonatomic, weak)UIImageView *imageView;
@end
@implementation GDLoopCell
- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setUI];
    }
    return self;
}
- (void)setUI{
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.contentView.frame), CGRectGetHeight(self.contentView.frame))];
//    UIImageView *imageView = [[UIImageView alloc]init];
//    self.imageView = imageView;
    /*
     或者通过layoutSubviews方法进行布局
     */
    self.imageView = imageView;
    [self.contentView addSubview:self.imageView];
}
- (void)setImageName:(NSString *)imageName{
    _imageName = imageName;
    self.imageView.image = [UIImage imageNamed:imageName];
}
//- (void)layoutSubviews{
//    [super layoutSubviews];
    //添加到父类视图上时会调用
//    self.imageView.frame = CGRectMake(0, 0, CGRectGetWidth(self.contentView.frame), CGRectGetHeight(self.contentView.frame));
//}

@end
